import { SearchOutlined } from '@ant-design/icons'
import { Switch } from 'antd'
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom'

import './index.scss'
export default function Mimicryinput({register,icon1,icon2,text,onFinish}) {
    const [data,setdata]=useState({username:'',password:''})
    const navi=useNavigate()
  return (
    <div className='mimicryinput'>
            <div className="search">
              
            <input type="text" className="search__input input1023" onChange={e=>setdata({...data,username:e.target.value})} placeholder="请输入手机号格式"/>
            <div className="search__icon">
              {icon1}
            </div>
          </div>

            <div className="search">
                <input type="text" onChange={e=>setdata({...data,password:e.target.value})} className="search__input" placeholder="请输入密码"/>
                <div className="search__icon">
                    {icon2}
                </div>
            </div>
       
        {
            register?
            '':<div className='content'>
                    <Switch checkedChildren="记住我" unCheckedChildren="忘记我" defaultChecked />
                    <span className='navi' onClick={()=>navi('/')}>忘记密码</span>
                </div>
        }
        
          <div className="btn btn__secondary" onClick={()=>onFinish(data)}><p>{text}</p></div>
         {register?'':<span className='goregister navi' onClick={()=>navi('/register')}>去注册</span>}
    </div>
  )
}
